package cn.yuan.xiaoyu.calendarmodule.utils;

import java.util.Calendar;

/**
 * Created by yukuoyuan on 6/02/2016.
 * 这是一个日历控件的工具类
 */
public class WeekViewUtil {
    /**
     * 比较两个Calendar 是否是同一天
     *
     * @param dayOne 第一天
     * @param dayTwo 第二天
     * @return
     */
    public static boolean isSameDay(Calendar dayOne, Calendar dayTwo) {
        return dayOne.get(Calendar.YEAR) == dayTwo.get(Calendar.YEAR) && dayOne.get(Calendar.DAY_OF_YEAR) == dayTwo.get(Calendar.DAY_OF_YEAR);
    }

    /**
     * 这是一个获取当天的Calendar的方法
     *
     * @return 当天的Calendar
     */
    public static Calendar today() {
        Calendar today = Calendar.getInstance();
        today.set(Calendar.HOUR_OF_DAY, 0);
        today.set(Calendar.MINUTE, 0);
        today.set(Calendar.SECOND, 0);
        today.set(Calendar.MILLISECOND, 0);
        return today;
    }
}
